
import * as types from '../types'

const reducer = (state = {
    count: 100
}, actions) => {

    switch (actions.type) {
        case types.ADD:

            return { ...state, count: state.count + 1 }
        case types.REDUCE:

            return { ...state, count: state.count - 1 }
        case types.ADDNUM:

            return { ...state, count: state.count + actions.payload }
        case types.REDUCENUM:

            return { ...state, count: state.count - actions.payload }
        default:

            return state    
        
    }
}

export default reducer